﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

public partial class Controls_SendToFriend : System.Web.UI.UserControl
{
    public LocalFunctions FUNC;
    protected void Page_Load(object sender, EventArgs e)
    {
        HtmlLink css1 = new HtmlLink();
        css1.Href = (FUNC.LangID == 1) ? "style/basic.css" : "style/basicHeb.css";
        css1.Attributes["rel"] = "stylesheet";
        css1.Attributes["type"] = "text/css";
        css1.Attributes["media"] = "screen";
        Page.Header.Controls.Add(css1);

        OkButton.Text = FUNC.GetPhrase(31);
        CancelButton.Text = FUNC.GetPhrase(38);
        //Page.Header.InnerHtml+= "<link type=\"text/css\" href=\"../style/basic.css\" rel=\"stylesheet\" media=\"screen\" />";
    }

    protected void btnSendToFriend_Click(object sender, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();

        if (FUNC.LangID == 1)
        {
            sb.AppendFormat("Comrade , {0}!<br/>", txtFriendName.Text);
            sb.AppendFormat("If you  love a good workout but the thrill is gone, if you love your workout routine tough but satisfying - then {0} invites you to check out the old-new school of workout. <br />", txtMyName.Text);
            sb.AppendFormat("Don't hesitate! Follow the <a href='http://beamonkey.net'>link<a> and discover the Monkey way of training. <br />");
            sb.AppendFormat("Be a Monkey,<br />");
            sb.Append("Michael Son");
        }
        else
        {
            sb.AppendFormat("קומרד {0},<br/>", txtFriendName.Text);
            sb.AppendFormat("אם אתה אוהב להתאמן אבל האימונים כבר לא מרגשים אותך, אם אתה נהנה מאימון קשה אך מספק - הגעת למקום הנכון!{0} מזמין אותך  לגלות את שיטת האימון הישנה-חדשה<br />", txtMyName.Text);
            sb.AppendFormat(" אל תהסס! לחץ על <a href='http://beamonkey.net'>הקישור<a> וחשוף את עצמך ל - Monkey way<br />");
            sb.AppendFormat("Be a Monkey, <br />");
            sb.Append("מיכאל סון");
        }
        //SendMail
        Helper.SendEmail(txtMyEmail.Text, txtMyName.Text, txtFriendEmail.Text, "New message from BeMonkey.", sb);

        string message = string.Empty;
        if (FUNC.LangID == 1)
        {
            message="Your message was sent!";
        }
        else
        {
            message = "ההזמנה שלך נשלחה בהצלחה!";
        }
        MyMessageBoxInfo.Show(MyMessageBox.MessageType.Info, message, 125, 300);      
    }
}
